<template>
	<view class="content">
		<view @click="search" class="color1"><topSearch></topSearch></view>
		<!-- <topTabbar></topTabbar> -->
		<banner></banner>
		<uni-grid class="color" :column="3" :square="false" :showBorder="false">
			<view class="nav_item" v-for="(item,index) of menus" :key="item.title" @click="navItemClick(item.path)">
				<uni-grid-item>
					<image class="image" :src="item.icon" mode="aspectFill"></image>
					<text class="text">{{item.title}}</text>
				</uni-grid-item>
			</view>
		</uni-grid>
		<listPane></listPane>
		<goodsPane></goodsPane>
	</view>
</view>	
</template>

<script>
	import {
		indexList,
		productList
	} from '@/api/product';
	import rfSwipeDot from '@/components/rf-swipe-dot';
	import rfFloorIndex from '@/components/rf-floor-index';
	import rfSearchBar from '@/components/rf-search-bar';
	import rfSwiperSlide from '@/components/rf-swiper-slide';
	import rfProductList from '@/components/rf-product-list';
	import listCell from '@/components/rf-list-cell';
	import { mapMutations } from 'vuex';
	import topSearch from "@/components/topSearch.vue"
	import topTabbar from "@/components/topTabbar.vue"
	import banner from "@/components/banner.vue"
	import uniGrid from "@/components/uni-grid/uni-grid.vue"
	import uniGridItem from "@/components/uni-grid-item/uni-grid-item.vue"
	import listPane from "@/components/listPane.vue"
	import goodsPane from "@/components/goodsPane.vue"
	import goodsList from "@/components/goods-list/goods-list.vue"
	export default {
		components: {
			topSearch,
			topTabbar,
			banner,
			uniGrid,
			uniGridItem,
			listPane,
			goodsPane,
			goodsList,
			rfFloorIndex,
			rfSwipeDot,
			rfProductList,
			rfSearchBar,
			listCell,
			rfSwiperSlide
		},
		data() {
			return {
				current: 0, // 轮播图index
				carouselList: {}, // 广告图
				hotProductList: [], // 热门商品列表
				recommendProductList: [], // 推荐商品列表
				guessYouLikeProductList: [], // 猜您喜欢商品列表
				newProductList: [], // 新品上市商品列表
				productCateList: [], // 商品栏目
				config: {}, // 商户配置
				announceList: [], // 公告列表
				share: {},
				loading: true,
				scrollTop: 0,
				kefuShow: true,
				loadingType: 'more',
				hotSearchDefault: '请输入关键字',
				newsBg: this.$mAssetsPath.newsBg,
				errorImage: this.$mAssetsPath.errorImage,
				appName: this.$mSettingConfig.appName,
				categoryList: [], // 分类列表
				categoryProductList: [], // 分类列表
				page: 1,
				currentCate: 0,
				hotRecommendList: this.$mConstDataConfig.hotRecommendList,
				productLoading: true,
				isOpenIndexCate: this.$mSettingConfig.isOpenIndexCate,
				moneySymbol: this.moneySymbol,
				merchantShow: false,
				merchantData: {},
				// swipers: [],
				menus: [{
						icon: 'https://m.360buyimg.com/mobilecms/s120x120_jfs/t1/20983/16/10753/6124/5c8a16aaE5d6b15d7/01e0e818a7505267.png.webp',
						title: '山师商城',
						path: '/pages/goods/goods'
					},
					{
						icon: 'https://m.360buyimg.com/mobilecms/s120x120_jfs/t1/39401/17/2391/5859/5cc06fcfE2ad40668/28cda0a571b4a576.png.webp',
						title: '校园风景',
						path: '/pages/view/view'
					},
					// {
					// 	icon: 'https://m.360buyimg.com/mobilecms/s120x120_jfs/t1/17169/3/4127/4611/5c2f35cfEd87b0dd5/65c0cdc1362635fc.png.webp',
					// 	title: '潮牌服饰',
					// 	path:'/pages/clothes/clothes'
					// },
					{
						icon: 'https://m.360buyimg.com/mobilecms/s120x120_jfs/t16990/157/2001547525/17770/a7b93378/5ae01befN2494769f.png.webp',
						title: '联系我们',
						path: '/pages/location/location'
					},
				]
			}
		},
		onPageScroll(e) {
			this.scrollTop = e.scrollTop;
		},
		computed: {
			statusBar () {
				const e = uni.getSystemInfoSync();
				return e.statusBarHeight;
			},
			// 计算倒计时时间
			second() {
				return function(val) {
					return Math.floor(15 * 60 - (new Date() / 1000 - val));
				};
			},
			bottom () {
				let bottom = 0;
				/*  #ifdef H5  */
				bottom = 90;
				/*  #endif */
				return bottom;
			},
			swipeCateList() {
				const list = this.productCateList;
				let result = [];
				for (let i = 0, len = list.length; i < len; i += 10) {
					result.push(list.slice(i, i + 10));
				}
				return result;
			}
		},
		onLoad() {
			 // this.getSwipers();

		},
		methods: {
			search(){
				uni.navigateTo({
					url:"/pages/index/search/search"
				})
			},
			// async getSwipers() {
			// 	const res = await this.$myRequest({
			// 		url: '/home/swiperdata'
			// 	})
			// 	this.swipers = res.data.message
			// },
			// async getSwipers() {
			// 	const res = await this.$myrequest({
			// 		url: '/api/getlunbo'
			// 	})
			// 	console.log(res)
			// },
			//导航点击的处理函数
			navItemClick(url) {
				uni.navigateTo({
					url
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.content {}

	.image {
		width: 100upx;
		height: 100upx;
		align-self: center;
		padding: 10upx;
	}

	.text {
		font-size: 35rpx;
		margin-top: 10rpx;
		text-align: center;
		font-weight: 545;

	}

	.nav_item {}
	.color{
		background: #fef2ec;
		margin-top: 15rpx;
		border-radius: 30rpx;
		margin-bottom: 15rpx;
	}.color1{
		background: white;
	}
</style>
